package com.health.system;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.util.Collections;

public class Main {
    public static void main(String[] args) {
        FastAutoGenerator.create("jdbc:mysql://localhost:3306/health?serverTimezone=UTC&useUnicode=true", "root", "123456")
                .globalConfig(builder -> {
                    builder.outputDir("C:\\Users\\34217\\Desktop\\demo"); // 指定输出目录
                })
                .packageConfig(builder -> {
                    builder.parent("com.health") // 设置父包名
                            .moduleName("system") // 设置父包模块名
                            .pathInfo(Collections.singletonMap(OutputFile.xml, "C:\\Users\\34217\\Desktop\\demo")); // 设置mapperXml生成路径
                })
                .strategyConfig(builder -> {
                    builder.addInclude("health_data", "health_rules", "health_suggestions") // 设置需要生成的表名
                            .mapperBuilder()
                            .serviceBuilder()
                            .formatServiceFileName("%sService")
                            .formatServiceImplFileName("%sServiceImp")
                    ; // 设置过滤表前缀
                })

                .execute();
    }
}
